using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.ComponentModel;
using System.Web.UI.WebControls;

namespace Org.Eurekaa.DNJ.UI.WebControls
{
    public class DNJTemplate : ITemplate
    {
        #region ITemplate Members

        public void InstantiateIn(Control container)
        {
            
        }

        #endregion
    }


    [
        ToolboxData("<{0}:DNJBox runat=server></{0}:DNJBox>"),
        ParseChildren(true),  
        ToolboxItem(false),     
        PersistChildren(false),
        DefaultProperty("Title")
    ]
    public class DNJBox : PlaceHolder
    {
        private string _title = "";
        private string _contentUrl = "";
        private bool _ajax = false;
        private ITemplate _content = new DNJTemplate();



        public DNJBox()
        {
            
        }
        public override string ToString()
        {
            return Title;
        }
        #region public properties

        
        public string Title
        {
            get { return _title; }
            set { _title = value; }
        }



        [Description("The url of ajax content : content is loaded from this url if ajax is enabled")]        
        [Editor(typeof(System.Web.UI.Design.UrlEditor), typeof(System.Drawing.Design.UITypeEditor))]
        [DefaultValue("")]
        public string ContentUrl
        {
            get { return _contentUrl; }
            set { _contentUrl = value; }
        }

        [Description("If true, the content of the box will be loaded using AJAX, from the specified URL")]
        [DefaultValue(false)]
        public bool Ajax
        {
            get { return _ajax; }
            set { _ajax = value; }
        }
       
        [
            PersistenceMode(PersistenceMode.InnerProperty), 
            //DefaultValue(typeof(ITemplate), ""),
            Browsable(false)
        ]
        public virtual ITemplate Content
        {
            get { return _content; }
            set
            {
                _content = value;
            }
        }
        #endregion public properties

        #region not implemented properties
        [Browsable(false)]
        public override bool EnableTheming
        {
            get
            {
                    return base.EnableTheming;
            }
            set
            {
                base.EnableTheming = value;
            }
        }

        [Browsable(false)]
        public override bool EnableViewState
        {
            get
            {
                return base.EnableViewState;
            }
            set
            {
                base.EnableViewState = value;
            }
        }

        [Browsable(false)]
        public override bool Visible
        {
            get
            {
                return base.Visible;
            }
            set
            {
                base.Visible = value;
            }
        }

        #endregion not implemented properties
    }
}


